package com.youuvs.controller;

import com.youuvs.domain.Store;
import com.youuvs.jsonResult.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.youuvs.service.IStoreService;

@RestController
@RequestMapping("/store")
public class StoreController {

    @Autowired
    private IStoreService storeService;
    @GetMapping("/getById/{id}")
    public Store select(@PathVariable("id") Long id){
        return storeService.getById(id);
    }


    @PostMapping("/insert")
    public JsonResult insert(@RequestBody Store store){
        try {
            storeService.insert(store);
            return new JsonResult();
        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult().setMsg("添加失败sto");
        }
    }


}
